package com.beerbear.eurekaservicesecond.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import java.util.HashMap;

@Service
public class OneService {

    private RestTemplate restTemplate;

    @Autowired
    public void setRestTemplate(RestTemplate restTemplate) {
        this.restTemplate = restTemplate;
    }

    /**
     * create by: Beer Bear
     * description: 调用Sercvice1中的接口
     * create time: 2021/8/18 21:36
     */
    public HashMap callService1(){
        String url = "http://eureka-service-first/firstService/call";
        HashMap response = restTemplate.getForObject(url,HashMap.class);
        return response;
    }

}
